const $http = window.$http;
// 部门
export function getAllDepartments (params) {
  return $http.request({ url: "/supervise/depart/queryTreeByParentId", params });
}

// 角色
export function getAllRoles (params) {
  return $http.request({ url: "/supervise/userRole/queryList", params });
}
// 获取包含部门的岗位列表
export function getDeptPostsList (params) {
  return $http.request({
    url: "/supervise/post/queryList",
    params,
  });
}

export function getPage (params) {
  return $http.request({
    url: "/supervise/user/queryPage",
    params,
  });
}

/**
 * 添加
 * @param {object} params
 * @returns
 */
export function addUser (params) {
  return $http.request({
    url: "/supervise/user/addUser",
    data: params,
    method: "POST",
  });
}

/**
 * 修改
 * @param {object} params
 * @returns
 */
export function edit (params) {
  return $http.request({
    url: "/supervise/user/editUser",
    data: params,
    method: "PUT",
  });
}

/**
 * 删除单个
 * @param {object} params
 * @returns
 */
export function deleteOne (params) {
  return $http.request({
    url: `/supervise/user/delete/${params}`,
    method: "DELETE",
  });
}
// export function forbiddenUser (params) {
//   return $http.request({
//     url: "/supervise/user/enableUser",
//     params,
//     method: "PUT",
//   });
// }

// 用户冻结
export function stopUser (params) {
  return $http.request({ method: 'put', url: "/supervise/user/stopUser", params });
}

// 用户启用
export function startUser (params) {
  return $http.request({ method: 'put', url: "/supervise/user/enableUser", params });
}